package at.ac.tuwien.mg.wh;

import java.util.List;

import javax.ejb.Remote;

import at.ac.tuwien.mg.wh.dto.DescribedItemDTO;
import at.ac.tuwien.mg.wh.dto.ItemDTO;
import at.ac.tuwien.mg.wh.exception.WarehouseException;


@Remote
public interface WarehouseBeanRemote {
	
	/**
	 * Creates new items in the stock catalog. 
	 * @param items
	 * @throws WarehouseException
	 */
	public void newItems(List<DescribedItemDTO> items);
	
	/**
	 * To store new pieces of items in the stock.
	 * @param items
	 * @throws WarehouseException
	 */
	public void addItems(List<ItemDTO> items) throws WarehouseException;
	
	/**
	 * To store new pieces of items in the stock and book them.
	 * @param items
	 * @throws WarehouseException
	 */
	public void addItems(List<ItemDTO> items, Long userId) throws WarehouseException;
	
	/**
	 * To take number of items from the stock. 
	 * @param items
	 * @param userId
	 * @throws WarehouseException
	 */
	public void removeItems(List<ItemDTO> items, Long userId) throws WarehouseException;	
	
	/**
	 * To book items.
	 * @param items
	 * @param userId
	 * @throws WarehouseException
	 */
	public void bookItems(List<ItemDTO> items, Long userId)throws WarehouseException;
	
	/**
	 * To cancel booking (number of items stays in stock)
	 * @param items
	 * @param userId
	 * @throws WarehouseException
	 */
	public void cancelBookedItems(List<ItemDTO> items , Long userId)throws WarehouseException;
		
	/**
	 * To find out how many pieces of the item are left in stock.
	 * @param catalogIds
	 * @return
	 * @throws WarehouseException
	 */
	public List<ItemDTO> getFreeItems(List<Long> catalogIds) throws WarehouseException;
	
	/**
	 * Only for TESTS.
	 */
	public void cleanDdData();
}
